import network

def connect_wifi():
    wlan = network.WLAN(network.STA_IF) # create station interface
    wlan.active(True)       # activate the interface
    wlan.connect('mi10pro', '88888888')
    # check wifi connected
    while wlan.isconnected() == False:
        print('Wifi lost connect...')
    # if connected
    print('Wifi connect successful')
    print(wlan.ifconfig())